<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Mp3 extends Base
{
    public static function add($map)
    {
        $data = self::where('name',$map['name'])->get();
        if($data->isEmpty()){
            $rwe = self::create($map);
            if($rwe){
                return 200;
            }
        }else{
            return 400;
        }
    }


    public static function saves($map)
    {

            unset($map['image']);
            $rwe = self::where('id',$map['id'])->update($map);
            if($rwe){
                return 200;
            }
        else{
            return 400;
        }
    }


    public function image()
    {
        return $this->belongsTo('App\Image','url','id');
    }
}
